// app/service/user.js
const Service = require('egg').Service;

class UserService extends Service {
  //注册用户
  async resign(account,pwd,pid){
    const result = await this.app.mysql.insert('user',{name:"管理员",account:account,pwd:pwd,islogin:1,pid:pid})
    return result
  }
  //查找用户信息
  async find(account) {
    const user = await this.app.mysql.get('user', {account:account});
    return user;
  }
  //查询所有用户
  async findAll() {
      const allUser = await this.app.mysql.select('user'); //return Array
      return allUser;
  }
}

module.exports = UserService;